/// @tags: Binom Exclusion Catalan
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

int const N = 3e6 + 5, mod = 1e9 + 7;

int n, m, lim, fac[N], inv[N];

inline LL qpow(LL base, int exp) {
  LL res = 1;
  for (; exp; exp >>= 1, base = base * base % mod)
    if (exp & 1) res = res * base % mod;
  return res;
}

inline LL solve(int n, int m) {
  return (n < 0 || m < 0) ? 0 : (LL)fac[n + m] * inv[n] % mod * inv[m] % mod;
}

inline void flip1(int &x, int &y) { swap(x, y), x--, y++; }

inline void flip2(int &x, int &y) { swap(x, y), x += m + 2, y -= m + 2; }

inline int main() {
  cin >> n >> m;
  fac[0] = 1;
  lim = max(n, m) * 3 + 1;
  for (int i = 1; i <= lim; ++i) fac[i] = (LL)fac[i - 1] * i % mod;
  inv[lim] = qpow(fac[lim], mod - 2);
  for (int i = lim - 1; i >= 0; --i) inv[i] = (LL)inv[i + 1] * (i + 1) % mod;
  int x = n + m + 1, y = n, ans = solve(x, y);
  while (x >= 0 && y >= 0) {
    flip1(x, y);
    if ((ans += mod - solve(x, y)) >= mod) ans -= mod;
    flip2(x, y);
    if ((ans += solve(x, y)) >= mod) ans -= mod;
  }
  x = n + m + 1, y = n;
  while (x >= 0 && y >= 0) {
    flip2(x, y);
    if ((ans += mod - solve(x, y)) >= mod) ans -= mod;
    flip1(x, y);
    if ((ans += solve(x, y)) >= mod) ans -= mod;
  }
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P3266 [JLOI2015] 骗我呢.in", "r", stdin);
  freopen("P3266 [JLOI2015] 骗我呢.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
